var GlasgowAssistant = Class.create(AbstractModule, {

setupWidgets: function() {

		//About
		this.controller.setupWidget(Mojo.Menu.appMenu, {
			omitDefaultItems: true
		}, {
			visible: true,
			items: [
      		Mojo.Menu.editItem,
			{ label: "Disclaimer", command: "do-disclaimer" },					
				{ label: "License", command: "do-license" },
				{ label: "Help", command: "do-help" }
			]
		});

	this.controller.setupWidget("eye", {
			label: "Eye",
			choices: [
				{ label: "No eye opening", value: 1},
				{ label: "Eye opening to pain", value: 2},
				{ label: "Eye opening to verbal command", value: 3},
				{ label: "Eyes open spontaneously", value: 4}
				
			]
		}, this.eyeModel = {
			value: 1
		});
		
	this.controller.setupWidget("verbal", {
			label: "Verbal",
			choices: [
				{ label: "No verbal response", value: 1},
				{ label: "Incomprehensible sounds", value: 2},
				{ label: "Inappropriate words", value: 3},
				{ label: "Confused", value: 4},
				{ label: "Oriented", value: 5}
				
			]
		}, this.verbalModel = {
			value: 1
		});
		
		
	this.controller.setupWidget("motor", {
			label: "Motor",
			choices: [
				{ label: "No motor response", value: 1},
				{ label: "Extension to pain", value: 2},
				{ label: "Flexion to pain", value: 3},
				{ label: "Withdrawal from pain", value: 4},
				{ label: "Localizes pain", value: 5},
				{ label: "Obeys commands", value: 6}
				
			]
		}, this.motorModel = {
			value: 1
		});

},



	calculate: function() {
	var result = gcscalc(parseInt(this.eyeModel.value),parseInt(this.verbalModel.value),parseInt(this.motorModel.value));
	var interp="moderate";
	if (result.gcs>12){
	interp="minor";
	}
  if (result.gcs<9){
	interp="severe (coma)";
	}
	if (result.gcs==15){
	interp="absent/negligible";
	}
	
	return "The GCS is " + result.gcs +"<br />The brain injury is considered "+interp;
	}
});

